package com.hongdee.help.by.service.impl;

import com.hongdee.crm.task.service.ITCrmCarMaintainTaskService;
import com.hongdee.help.by.service.ITaskByService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 保养相关任务实施帮助功能
 */
@Service
public class TaskByServiceImpl implements ITaskByService {

    //导入保养相关service
    @Resource(name = "firstCarMaintainTaskService")
    private ITCrmCarMaintainTaskService crmCarMaintainTaskService;
    @Resource(name = "TwoCarMaintainTaskService")
    private ITCrmCarMaintainTaskService twoCrmCarMaintainTaskService;
    @Resource(name = "dbCarMaintainTaskService")
    private ITCrmCarMaintainTaskService dbCarMaintainTaskService;
    @Resource(name = "FirstMonthMaintainTaskService")
    private ITCrmCarMaintainTaskService firstMonthMaintainTaskService;


    /**
     * 指定公司指定日期内的生成新车首月
     * @param companyId
     * @param startTime
     * @param endTime
     * @throws Exception
     */
    @Override
    public void createNewCarFirstMonthTask(String companyId, String startTime, String endTime) throws Exception {
        firstMonthMaintainTaskService.carMaintain(companyId,startTime,endTime);
    }

    /**
     * 指定公司指定日期内的生成首保
     * @param companyId
     * @param startTime
     * @param endTime
     * @throws Exception
     */
    @Override
    public void createSbTask(String companyId, String startTime, String endTime) throws Exception {
        crmCarMaintainTaskService.carMaintain(companyId,startTime,endTime);
    }

    /**
     * 指定公司指定日期内的生成二保任务
     * @param companyId
     * @param startTime
     * @param endTime
     * @throws Exception
     */
    @Override
    public void createEbTask(String companyId, String startTime, String endTime) throws Exception {
        twoCrmCarMaintainTaskService.carMaintain(companyId,startTime,endTime);
    }

    /**
     * 指定公司指定日期内的生成定保任务
     * @param companyId
     * @param startTime
     * @param endTime
     * @throws Exception
     */
    @Override
    public void createDbTask(String companyId, String startTime, String endTime) throws Exception {
        dbCarMaintainTaskService.carMaintain(companyId,startTime,endTime);
    }

    /**
     * 指定公司指定日期内的生成保养任务
     * @param companyId
     * @param startTime
     * @param endTime
     * @throws Exception
     */
    @Override
    public void createByTask(String companyId, String startTime, String endTime) throws Exception {
        this.createNewCarFirstMonthTask(companyId,startTime,endTime);
        this.createSbTask(companyId,startTime,endTime);
        this.createEbTask(companyId,startTime,endTime);
        this.createDbTask(companyId,startTime,endTime);
    }
}
